package com.xaicode.learn.java.multithreadarch.ch2;

import java.util.stream.IntStream;

/**
 * @author Locker cjxia@isoftstone.com
 * @version 1.0
 */
public class Test {

    public static void main(String[] args) {
//        IntStream.range(0, 5).boxed()
//                .map(i -> new Thread(() -> System.out.println(Thread.currentThread().getName())))
//                .forEach(Thread::start);

        IntStream.range(0, 5)
                .mapToObj(Test::createThread)
                .forEach(Thread::start);

        System.getSecurityManager();

    }

    static Thread createThread(final int intName) {
        return new Thread(() -> System.out.println(Thread.currentThread().getName()), "PP" + intName);
    }

}
